package com.xm.xmapp.app;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by IntelliJ IDEA.
 * User: 缃椾唬鍧?
 * Date: 2010-8-5
 * Time: 21:14:02
 * 涓崥绉戝垱淇℃伅鎶?鏈湁闄愬叕鍙?
 * 绾跨▼姹?
 */
public class ThreadPoolFactory {
    private static ThreadPoolFactory ourInstance = new ThreadPoolFactory();

    public static ThreadPoolFactory getInstance() {
        return ourInstance;
    }

    private ExecutorService threadPool;

    private ThreadPoolFactory() {
        threadPool = Executors.newCachedThreadPool();
    }

    /**
     * 鎻愪氦缁欑嚎绋嬫睜鎵ц
     *
     * @param run
     */
    public void execute(Runnable run) {
        threadPool.submit(run);
    }
}
